package com.naver.geotools;

import java.io.IOException;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.operation.distance.DistanceOp;

public class ShotestLineTest {
	public static void main(String[] args) throws IOException, ParseException {
		LineString line = (LineString)new WKTReader().read("LINESTRING (131.44446711015 37.333333333333, 131.48532350993 37.322344447031)");
		Point point = (Point)new WKTReader().read("POINT (131.43446914015 37.34313332333)");
		
		double distance = line.distance(point);
		Coordinate[] closestPoints = DistanceOp.closestPoints(line, point);
		System.out.println(distance);
	}

}
